const { createProxyMiddleware }=require("http-proxy-middleware");

module.exports=(app)=>{ 
    app.use(createProxyMiddleware('/api', {
        target: 'http://localhost:3000',//目标地址
        changeOrigin: true,//允许跨域
        ws: true,//webscoket
        pathRewrite: {//路径重定向
           "^/api":"http://localhost:3000"
        },
    }));
}